﻿<%@ Page Title="" Language="C#" MasterPageFile="BGMasterPage.master" AutoEventWireup="true"
    CodeFile="LogList.aspx.cs" Inherits="LogList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHeader" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphContent" runat="Server">
    <table id="jqGridId">
    </table>
    <div id="pager">
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Bottom" runat="Server">
    <script type="text/javascript">
        $(function () { 
        $("#jqGridId").jqGrid({   
        url: "Handler/LogHandler.ashx?mode=getDataList",
        editurl:"Handler/LogHandler.ashx?mode=edit",
        datatype:"json", //为local时初始化不加载，支持json，xml等   
        mtype: "POST",   shrinkToFit:true,autoload:false,
        colNames:['编号', '时间', '操作','IP','内容'], //表头   
        colModel:[ //这里会根据index去解析jsonReader中root对象的属性，填充cell   
            {name:'ID', index:'ID', width:55, align:"center",sortable:false,key:true},  
            {name:'LogTime', index:'LogTime', width:120, sortable:false},
//            {name:'Operation', index:'Operation', width:120,align:"right",sortable:false,editable:true,edittype:"select",editoptions:{value:"<%=AllGroups %>"}},   
            {name:'Operation', index:'Operation', width:120,align:"right",sortable:false,editable:true,formatter:"select",edittype:"select",editoptions:{value:"<%=AllGroups %>"}},   
            {name:'IP', index:'IP', width:120, sortable:true},
            {name:'Content', index:'Content', sortable:false},
        ],   
        width: $("#jqGridId").parent().width(), //数字 & 'auto','100%'   
        height: $(window).height()-90,   
        rowNum: 100, //每页记录数   
        rowList:[5, 10,50,100], //每页记录数可选列表   
        pager: '#pager', //分页标签divID   
        viewrecords: true, //显示记录数信息，如果这里设置为false,下面的不会显示 recordtext: "第{0}到{1}条, 共{2}条记录", //默认显示为{0}-{1} 共{2}条 scroll: false, //滚动翻页，设置为true时翻页栏将不显示  
        /**这里是排序的默认设置，这些值会根据列表header点击排序时覆盖*/ sortable: false,   
        sortname: "id",   
        sortorder: "desc",   
  
        caption:"日志列表", //显示查询结果表格标题   
        rownumbers: true, //设置列表显示序号,需要注意在colModel中不能使用rn作为index   
        rownumWidth: 20, //设置显示序号的宽度，默认为25   
        multiselect: true, //多选框   
        multiboxonly: true, //在点击表格row时只支持单选，只有当点击checkbox时才多选，需要multiselect=true是有效   
        prmNames : { //如当前查询实体为ware，这些可以在查询对象的superObject中设定   
            page: "pageIndex",   
            rows: "pageSize",   
            sort: "sort",   
            order: "sord",   
            search: "search"   
        },   
        jsonReader:{ //server返回Json解析设定   
            root: "list", //对于json中数据列表   
            page: "pageIndex",   
            total: "pageCount",   
            records: "recordCount",  
            repeatitems: false,   
        },
        editSubmit : function(response, postdata) 
        { 
        alert("submit");
        return [true,"test"] 
        }
    });   
        var editOptions={ top: ($(window).height()-200)/2, left: ($("#jqGridId").width()-300)/2, width: 300,closeOnEscape: true,reloadAfterSubmit:false,closeAfterEdit:true, afterSubmit: function(response, postdata){
        var data = $.parseJSON(response.responseText);return[data.Result,data.Message,data.ID];
    }};
    $("#jqGridId").jqGrid('navGrid','#pager',{edit:false,add:false,del:true,search:false},editOptions,editOptions,editOptions);//这里设定分页bar显示的信息
    });
    </script>
</asp:Content>
